package com.ruoyi.crm.service.impl;

import org.springframework.stereotype.Service;

import com.ruoyi.comm.crud.service.impl.BaseBQImpls;
import com.ruoyi.common.constant.UserConstants;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.crm.bean.bo.CustInfoBO;
import com.ruoyi.crm.bean.vo.qo.CustInfoQO;
import com.ruoyi.crm.domain.CustInfo;
import com.ruoyi.crm.mapper.CustInfoMapper;
import com.ruoyi.crm.service.ICustInfoService;

/**
 * 案件类型信息 服务层处理
 * 
 * @author riverbo
 */
@Service
public class CustInfoServiceImpl extends BaseBQImpls<CustInfoMapper, CustInfo, CustInfoBO, CustInfoQO> implements ICustInfoService {

	@Override
	public Boolean checkNameUnique(CustInfo t) {
        Long boId = StringUtils.isNull(t.getCustId()) ? -1L : t.getCustId();
        Long dbId = this.baseMapper.getIdByName(t);
        if (StringUtils.isNotNull(dbId) && dbId.longValue() != boId.longValue()) {
            return UserConstants.NOT_UNIQUE;
        }
        return UserConstants.UNIQUE;
	}

}
